/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import DAO.*;
import DTO.*;
import java.awt.Desktop;
import java.util.List;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.*;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

import java.awt.event.*;
import java.io.File;
import java.io.IOException;

import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.swing.JRViewer;


/**
 *
 * @author Luis Olave 10
 */
public class IngresoGarantiaAutomotriz extends javax.swing.JFrame {

    Connection conexion, conexion2;
    Statement st, st2;
    ResultSet rs, rs2;
    DefaultComboBoxModel modeloCombo6 = new DefaultComboBoxModel();
    DefaultComboBoxModel modeloCombo7 = new DefaultComboBoxModel();
    usuarioDTO user;
    garantiasDAO reg = new garantiasDAO();

    /**
     * Creates new form IngresoGarantiaAutomotriz
     */
    public IngresoGarantiaAutomotriz(usuarioDTO user) {
        this.user = user;
        initComponents();
        cargarItemsComboBoxSucursal();
        //cargarItemsComboBoxMarca();
        cargarItemsComboBoxMoneda();
        cargarItemsComboBoxTipoGarantia();
        //cargarItemsComboBoxModelo();
        txtFechaCreacion.setText(DAO.Fechas.FechaSistema());
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        llenar_marca();

        this.cmbMarca.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg) {
                llenar_modelo((String) cmbMarca.getSelectedItem().toString());
            }
        });

    }

    public void llenar_marca() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexion = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/garantias", "root", "1234");
            st = (Statement) conexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rs = st.executeQuery("SELECT * FROM marca");
            modeloCombo6.addElement("Seleccione una Marca");
            cmbMarca.setModel(modeloCombo6);
            while (rs.next()) {
                modeloCombo6.addElement(rs.getObject("nom_marca"));
                cmbMarca.setModel(modeloCombo6);
            }

            st.close();
        } catch (SQLException ex) {
            Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void llenar_modelo(String nom_marca) {
        this.cmbModelo.enable(true);
        this.cmbModelo.removeAllItems();
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexion = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/garantias", "root", "1234");
            st = (Statement) conexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rs = st.executeQuery("SELECT * FROM modelo,marca "
                    + "WHERE modelo.id_marca=marca.id_marca "
                    + "AND nom_marca='" + nom_marca + "'");
            modeloCombo7.addElement("Seleccione un Modelo");
            cmbModelo.setModel(modeloCombo7);
            while (rs.next()) {
                modeloCombo7.addElement(rs.getObject("nom_modelo"));
                cmbModelo.setModel(modeloCombo7);
            }

            st.close();
        } catch (SQLException ex) {
            Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void cargarItemsComboBoxSucursal() {
        List<sucursalDTO> ListaSucursal = CCSucursal.listarItemSucursal();
        if (ListaSucursal != null) {
            int size = ListaSucursal.size();
            for (int i = 0; i < size; i++) {
                this.cmbSucursal.addItem(ListaSucursal.get(i));
            }
        }
    }

//    private void cargarItemsComboBoxMarca() {
//        List<marcaDTO> ListaMarca = CCMarca.listarItemMarca();
//        if (ListaMarca != null) {
//            int size = ListaMarca.size();
//            for (int i = 0; i < size; i++) {
//                this.cmbMarca.addItem(ListaMarca.get(i));
//            }
//        }
//    }
    private void cargarItemsComboBoxMoneda() {
        List<monedaDTO> ListaMoneda = CCMoneda.listarItemMoneda();
        if (ListaMoneda != null) {
            int size = ListaMoneda.size();
            for (int i = 0; i < size; i++) {
                this.cmbMoneda.addItem(ListaMoneda.get(i));
            }
        }
    }

    private void cargarItemsComboBoxTipoGarantia() {
        List<tipoGarantiaDTO> ListaTipoGtia = CCTipoGarantia.listarItemTipoGarantia();
        if (ListaTipoGtia != null) {
            int size = ListaTipoGtia.size();
            for (int i = 0; i < size; i++) {
                this.cmbTipoGarantia.addItem(ListaTipoGtia.get(i));
            }
        }
    }
    
//    private void cargarTxtArea(){
//    
//        
//        String cadena = "prueba garantia automotriz";
//        
//        if(txtRutGara.getText().length()>0){
//        txtDescripcionAuto.setText(cadena);
//        }
//        else
//        {
//        
//        }
//    }

//    private void cargarItemsComboBoxModelo() {
//        List<modeloDTO> ListaModelo = CCModelo.listarItemModelo();
//        if (ListaModelo != null) {
//            int size = ListaModelo.size();
//            for (int i = 0; i < size; i++) {
//                this.cmbModelo.addItem(ListaModelo.get(i));
//            }
//        }
//    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblLogo = new javax.swing.JLabel();
        lblIngresoGaraAuto = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        pnlIngreseRutGarante = new javax.swing.JPanel();
        lblRut = new javax.swing.JLabel();
        txtRutBuscar = new javax.swing.JTextField();
        btnBuscar = new javax.swing.JButton();
        pnlDatosPersoGara = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        lblRutGara = new javax.swing.JLabel();
        lblApellidoPater = new javax.swing.JLabel();
        lblApellidoMater = new javax.swing.JLabel();
        lblNombre = new javax.swing.JLabel();
        lblFechNac = new javax.swing.JLabel();
        lblSexo = new javax.swing.JLabel();
        txtFechNac = new javax.swing.JTextField();
        txtSexo = new javax.swing.JTextField();
        txtNombre = new javax.swing.JTextField();
        txtApellidoMaterno = new javax.swing.JTextField();
        txtApellidoPaterno = new javax.swing.JTextField();
        txtRutGara = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        lblCalleAvenida = new javax.swing.JLabel();
        lblNumero = new javax.swing.JLabel();
        lblDepto = new javax.swing.JLabel();
        lblRegion = new javax.swing.JLabel();
        lblComuna = new javax.swing.JLabel();
        lblTelParticular = new javax.swing.JLabel();
        lblTelMovil = new javax.swing.JLabel();
        txtCalleAvenida = new javax.swing.JTextField();
        txtNumero = new javax.swing.JTextField();
        txtDepto = new javax.swing.JTextField();
        txtRegion = new javax.swing.JTextField();
        txtComuna = new javax.swing.JTextField();
        txtTelParticular = new javax.swing.JTextField();
        txtTelMovil = new javax.swing.JTextField();
        btnMenuPrincipal = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        pnlDescripGarantia = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtOtroComentarioAuto = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtDescripcionAuto = new javax.swing.JTextArea();
        lblDescripcion = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        pnlCreacionGaraAuto = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        lblSucursal = new javax.swing.JLabel();
        lblDireccion = new javax.swing.JLabel();
        lblMarca = new javax.swing.JLabel();
        lblPatente = new javax.swing.JLabel();
        lblNumChasis = new javax.swing.JLabel();
        FechCreacion = new javax.swing.JLabel();
        FechUltDebito = new javax.swing.JLabel();
        txtDireccion = new javax.swing.JTextField();
        txtNumChasis = new javax.swing.JTextField();
        txtPatente = new javax.swing.JTextField();
        cmbMarca = new javax.swing.JComboBox();
        cmbSucursal = new javax.swing.JComboBox();
        lblFechModifica = new javax.swing.JLabel();
        lblFechUltTasacion = new javax.swing.JLabel();
        lblNumMotor = new javax.swing.JLabel();
        txtNumMotor = new javax.swing.JTextField();
        txtAño = new javax.swing.JTextField();
        lblAño = new javax.swing.JLabel();
        lblMoneda = new javax.swing.JLabel();
        cmbMoneda = new javax.swing.JComboBox();
        jcFechUltDebito = new com.toedter.calendar.JDateChooser();
        jcFechUltTasacion = new com.toedter.calendar.JDateChooser();
        jcFechModifica = new com.toedter.calendar.JDateChooser();
        txtFechaCreacion = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        lblTipoGarantia = new javax.swing.JLabel();
        lblModelo = new javax.swing.JLabel();
        lblNumRegPrenda = new javax.swing.JLabel();
        lblFechExtincion = new javax.swing.JLabel();
        lblFechUltRevaluo = new javax.swing.JLabel();
        FechUltCredito = new javax.swing.JLabel();
        cmbModelo = new javax.swing.JComboBox();
        cmbTipoGarantia = new javax.swing.JComboBox();
        txtNumRegPrenda = new javax.swing.JTextField();
        jcFechExtincion = new com.toedter.calendar.JDateChooser();
        jcFechUltRevaluo = new com.toedter.calendar.JDateChooser();
        jcFechUltCredito = new com.toedter.calendar.JDateChooser();
        jPanel10 = new javax.swing.JPanel();
        lblArchivo1 = new javax.swing.JLabel();
        txtMontoInicial = new javax.swing.JTextField();
        jPanel9 = new javax.swing.JPanel();
        lblArchivo = new javax.swing.JLabel();
        txtAdjuntarArchivo = new javax.swing.JTextField();
        btnExaminar = new javax.swing.JButton();
        btnAdjuntar = new javax.swing.JButton();
        btnMenuGaraAuto = new javax.swing.JButton();
        btnGrabarAutom = new javax.swing.JButton();
        btnExportarHipo = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        txtBuscarPatente = new javax.swing.JTextField();
        btnBuscarIngresoGarantiaAutomotriz = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbSalidaImpresionAutomotriz = new javax.swing.JTable();
        btnImprimirAutomotriz = new javax.swing.JButton();
        btnMenuPrincipalAuto = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("INGRESO GARANTÍA AUTOMOTRIZ");
        setResizable(false);

        lblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGE/logo.JPG"))); // NOI18N

        lblIngresoGaraAuto.setFont(new java.awt.Font("Century Gothic", 1, 18)); // NOI18N
        lblIngresoGaraAuto.setText("INGRESO GARANTÍA AUTOMOTRIZ");

        jTabbedPane1.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N

        pnlIngreseRutGarante.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE RUT GARANTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        lblRut.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblRut.setText("RUT");

        btnBuscar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnBuscar.setText("BUSCAR");
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlIngreseRutGaranteLayout = new javax.swing.GroupLayout(pnlIngreseRutGarante);
        pnlIngreseRutGarante.setLayout(pnlIngreseRutGaranteLayout);
        pnlIngreseRutGaranteLayout.setHorizontalGroup(
            pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlIngreseRutGaranteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblRut)
                .addGap(18, 18, 18)
                .addGroup(pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtRutBuscar)
                    .addComponent(btnBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                .addContainerGap(52, Short.MAX_VALUE))
        );
        pnlIngreseRutGaranteLayout.setVerticalGroup(
            pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlIngreseRutGaranteLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblRut)
                    .addComponent(txtRutBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBuscar)
                .addContainerGap())
        );

        pnlDatosPersoGara.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DATOS PERSONALES GARANTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        lblRutGara.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblRutGara.setText("RUT");

        lblApellidoPater.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblApellidoPater.setText("APELLIDO PATERNO");

        lblApellidoMater.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblApellidoMater.setText("APELLIDO MATERNO");

        lblNombre.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblNombre.setText("NOMBRE");

        lblFechNac.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblFechNac.setText("FECHA NACIMIENTO");

        lblSexo.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblSexo.setText("SEXO");

        txtFechNac.setEditable(false);
        txtFechNac.setBackground(new java.awt.Color(255, 255, 102));
        txtFechNac.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtFechNac.setEnabled(false);

        txtSexo.setEditable(false);
        txtSexo.setBackground(new java.awt.Color(255, 255, 102));
        txtSexo.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtSexo.setEnabled(false);

        txtNombre.setEditable(false);
        txtNombre.setBackground(new java.awt.Color(255, 255, 102));
        txtNombre.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtNombre.setEnabled(false);

        txtApellidoMaterno.setEditable(false);
        txtApellidoMaterno.setBackground(new java.awt.Color(255, 255, 102));
        txtApellidoMaterno.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtApellidoMaterno.setEnabled(false);

        txtApellidoPaterno.setEditable(false);
        txtApellidoPaterno.setBackground(new java.awt.Color(255, 255, 102));
        txtApellidoPaterno.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtApellidoPaterno.setEnabled(false);

        txtRutGara.setBackground(new java.awt.Color(255, 255, 102));
        txtRutGara.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtRutGara.setEnabled(false);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblFechNac)
                            .addComponent(lblSexo)
                            .addComponent(lblNombre))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtSexo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtFechNac, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblApellidoMater)
                            .addComponent(lblApellidoPater)
                            .addComponent(lblRutGara))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtRutGara, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtApellidoPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtApellidoMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(52, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblRutGara)
                    .addComponent(txtRutGara, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblApellidoPater)
                    .addComponent(txtApellidoPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblApellidoMater)
                    .addComponent(txtApellidoMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombre)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblFechNac)
                    .addComponent(txtFechNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSexo)
                    .addComponent(txtSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        lblCalleAvenida.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblCalleAvenida.setText("CALLE / AVENIDA");

        lblNumero.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblNumero.setText("NÚMERO");

        lblDepto.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblDepto.setText("DEPTO.");

        lblRegion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblRegion.setText("REGIÓN");

        lblComuna.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblComuna.setText("COMUNA");

        lblTelParticular.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblTelParticular.setText("TEL. PARTICULAR");

        lblTelMovil.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblTelMovil.setText("TEL. MOVIL");

        txtCalleAvenida.setEditable(false);
        txtCalleAvenida.setBackground(new java.awt.Color(255, 255, 102));
        txtCalleAvenida.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtCalleAvenida.setEnabled(false);
        txtCalleAvenida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCalleAvenidaActionPerformed(evt);
            }
        });

        txtNumero.setEditable(false);
        txtNumero.setBackground(new java.awt.Color(255, 255, 102));
        txtNumero.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtNumero.setEnabled(false);

        txtDepto.setEditable(false);
        txtDepto.setBackground(new java.awt.Color(255, 255, 102));
        txtDepto.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtDepto.setEnabled(false);

        txtRegion.setEditable(false);
        txtRegion.setBackground(new java.awt.Color(255, 255, 102));
        txtRegion.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtRegion.setEnabled(false);

        txtComuna.setEditable(false);
        txtComuna.setBackground(new java.awt.Color(255, 255, 102));
        txtComuna.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtComuna.setEnabled(false);

        txtTelParticular.setEditable(false);
        txtTelParticular.setBackground(new java.awt.Color(255, 255, 102));
        txtTelParticular.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtTelParticular.setEnabled(false);

        txtTelMovil.setEditable(false);
        txtTelMovil.setBackground(new java.awt.Color(255, 255, 102));
        txtTelMovil.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtTelMovil.setEnabled(false);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblCalleAvenida)
                    .addComponent(lblDepto)
                    .addComponent(lblRegion)
                    .addComponent(lblComuna)
                    .addComponent(lblTelParticular)
                    .addComponent(lblTelMovil))
                .addGap(18, 18, 18)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(txtTelParticular, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)
                    .addComponent(txtComuna, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtRegion, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDepto, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtCalleAvenida, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtTelMovil))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblNumero)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCalleAvenida)
                    .addComponent(txtCalleAvenida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNumero)
                    .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDepto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDepto))
                .addGap(6, 6, 6)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtRegion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblRegion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtComuna, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblComuna))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtTelParticular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTelParticular))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtTelMovil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTelMovil))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlDatosPersoGaraLayout = new javax.swing.GroupLayout(pnlDatosPersoGara);
        pnlDatosPersoGara.setLayout(pnlDatosPersoGaraLayout);
        pnlDatosPersoGaraLayout.setHorizontalGroup(
            pnlDatosPersoGaraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPersoGaraLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        pnlDatosPersoGaraLayout.setVerticalGroup(
            pnlDatosPersoGaraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDatosPersoGaraLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlDatosPersoGaraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        btnMenuPrincipal.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnMenuPrincipal.setText("MENÚ PRINCIPAL");
        btnMenuPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(pnlDatosPersoGara, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(299, 299, 299)
                                .addComponent(pnlIngreseRutGarante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(btnMenuPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlIngreseRutGarante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(pnlDatosPersoGara, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnMenuPrincipal)
                .addContainerGap(54, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("INFO. GARANTE", jPanel2);

        pnlDescripGarantia.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DESCRIPCIÓN GARANTIA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        txtOtroComentarioAuto.setColumns(20);
        txtOtroComentarioAuto.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtOtroComentarioAuto.setRows(5);
        txtOtroComentarioAuto.setText("OTRO COMENTARIO ...");
        txtOtroComentarioAuto.setToolTipText("");
        jScrollPane3.setViewportView(txtOtroComentarioAuto);

        txtDescripcionAuto.setBackground(new java.awt.Color(255, 255, 102));
        txtDescripcionAuto.setColumns(20);
        txtDescripcionAuto.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtDescripcionAuto.setRows(5);
        txtDescripcionAuto.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        jScrollPane4.setViewportView(txtDescripcionAuto);

        lblDescripcion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblDescripcion.setText("DESCRIPCIÓN");

        javax.swing.GroupLayout pnlDescripGarantiaLayout = new javax.swing.GroupLayout(pnlDescripGarantia);
        pnlDescripGarantia.setLayout(pnlDescripGarantiaLayout);
        pnlDescripGarantiaLayout.setHorizontalGroup(
            pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDescripGarantiaLayout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addComponent(lblDescripcion)
                .addGap(18, 18, 18)
                .addGroup(pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
                    .addComponent(jScrollPane3))
                .addContainerGap())
        );
        pnlDescripGarantiaLayout.setVerticalGroup(
            pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDescripGarantiaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlDescripGarantiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDescripcion)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(250, 250, 250))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDescripGarantia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDescripGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(88, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("DESCRIP. GARANTÍA", jPanel3);

        jPanel4.setPreferredSize(new java.awt.Dimension(815, 600));

        pnlCreacionGaraAuto.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "CREACIÓN GARANTÍA AUTOMOTRIZ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        lblSucursal.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblSucursal.setText("SUCURSAL");

        lblDireccion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblDireccion.setText("DIRECCIÓN (CRÉDITO)");

        lblMarca.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblMarca.setText("MARCA");

        lblPatente.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblPatente.setText("PATENTE");

        lblNumChasis.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblNumChasis.setText("N° CHASIS");

        FechCreacion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        FechCreacion.setText("FECHA CREACIÓN");

        FechUltDebito.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        FechUltDebito.setText("FECHA ÚLT. DEBITO");

        txtDireccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtDireccionKeyReleased(evt);
            }
        });

        txtNumChasis.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtNumChasisKeyReleased(evt);
            }
        });

        txtPatente.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtPatenteKeyReleased(evt);
            }
        });

        cmbMarca.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbMarca.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        cmbSucursal.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbSucursal.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        lblFechModifica.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblFechModifica.setText("FECHA MODIFICA.");

        lblFechUltTasacion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblFechUltTasacion.setText("FECHA ÚLT. TASACIÓN");

        lblNumMotor.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblNumMotor.setText("N° MOTOR");

        txtNumMotor.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtNumMotorKeyReleased(evt);
            }
        });

        txtAño.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtAñoKeyReleased(evt);
            }
        });

        lblAño.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblAño.setText("AÑO");

        lblMoneda.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblMoneda.setText("MONEDA");

        cmbMoneda.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbMoneda.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione Moneda" }));

        txtFechaCreacion.setEditable(false);
        txtFechaCreacion.setBackground(new java.awt.Color(255, 255, 0));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDireccion)
                    .addComponent(FechUltDebito)
                    .addComponent(FechCreacion)
                    .addComponent(lblNumChasis)
                    .addComponent(lblPatente)
                    .addComponent(lblMarca)
                    .addComponent(lblSucursal)
                    .addComponent(lblFechUltTasacion)
                    .addComponent(lblFechModifica)
                    .addComponent(lblMoneda)
                    .addComponent(lblAño)
                    .addComponent(lblNumMotor))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtPatente, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNumChasis, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmbMarca, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmbSucursal, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtDireccion)
                    .addComponent(txtNumMotor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtAño, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmbMoneda, 0, 1, Short.MAX_VALUE)
                    .addComponent(jcFechUltTasacion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechModifica, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechUltDebito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtFechaCreacion))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSucursal)
                    .addComponent(cmbSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDireccion)
                    .addComponent(txtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblMarca)
                    .addComponent(cmbMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPatente)
                    .addComponent(txtPatente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumChasis)
                    .addComponent(txtNumChasis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(FechCreacion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(FechUltDebito))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtFechaCreacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcFechUltDebito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblMoneda)
                    .addComponent(cmbMoneda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblAño)
                    .addComponent(txtAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumMotor)
                    .addComponent(txtNumMotor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblFechUltTasacion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblFechModifica)
                        .addContainerGap(33, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jcFechUltTasacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcFechModifica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        lblTipoGarantia.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblTipoGarantia.setText("TIPO GARANTÍA");

        lblModelo.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblModelo.setText("MODELO");

        lblNumRegPrenda.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblNumRegPrenda.setText("N° REG. PRENDA");

        lblFechExtincion.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblFechExtincion.setText("FECHA EXTINCIÓN");

        lblFechUltRevaluo.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblFechUltRevaluo.setText("FECHA ÚLT. REVALUO");

        FechUltCredito.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        FechUltCredito.setText("FECHA ÚLT. CREDITO");

        cmbModelo.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbModelo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        cmbTipoGarantia.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbTipoGarantia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        txtNumRegPrenda.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtNumRegPrendaKeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(FechUltCredito)
                            .addComponent(lblFechExtincion)
                            .addComponent(lblModelo)
                            .addComponent(lblTipoGarantia)
                            .addComponent(lblNumRegPrenda))
                        .addGap(24, 24, 24))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addComponent(lblFechUltRevaluo)
                        .addGap(18, 18, 18)))
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtNumRegPrenda, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmbModelo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmbTipoGarantia, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechExtincion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechUltRevaluo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcFechUltCredito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(26, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTipoGarantia)
                    .addComponent(cmbTipoGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblModelo)
                    .addComponent(cmbModelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumRegPrenda)
                    .addComponent(txtNumRegPrenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jcFechExtincion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblFechExtincion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblFechUltRevaluo)
                    .addComponent(jcFechUltRevaluo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(FechUltCredito)
                    .addComponent(jcFechUltCredito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "GARANTÍA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        lblArchivo1.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblArchivo1.setText("MONTO INICIAL");

        txtMontoInicial.setBackground(new java.awt.Color(255, 255, 102));
        txtMontoInicial.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        txtMontoInicial.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtMontoInicial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMontoInicialActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblArchivo1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(txtMontoInicial, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtMontoInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblArchivo1))
                .addContainerGap())
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ADJUNTAR ARCHIVO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        lblArchivo.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblArchivo.setText("ARCHIVO");

        txtAdjuntarArchivo.setEditable(false);
        txtAdjuntarArchivo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtAdjuntarArchivoActionPerformed(evt);
            }
        });

        btnExaminar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnExaminar.setText("EXAMINAR");
        btnExaminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExaminarActionPerformed(evt);
            }
        });

        btnAdjuntar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnAdjuntar.setText("ADJUNTAR");
        btnAdjuntar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdjuntarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblArchivo)
                .addGap(18, 18, 18)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(btnExaminar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAdjuntar))
                    .addComponent(txtAdjuntarArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblArchivo)
                    .addComponent(txtAdjuntarArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnExaminar)
                    .addComponent(btnAdjuntar))
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlCreacionGaraAutoLayout = new javax.swing.GroupLayout(pnlCreacionGaraAuto);
        pnlCreacionGaraAuto.setLayout(pnlCreacionGaraAutoLayout);
        pnlCreacionGaraAutoLayout.setHorizontalGroup(
            pnlCreacionGaraAutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCreacionGaraAutoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 180, Short.MAX_VALUE)
                .addGroup(pnlCreacionGaraAutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        pnlCreacionGaraAutoLayout.setVerticalGroup(
            pnlCreacionGaraAutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCreacionGaraAutoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCreacionGaraAutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCreacionGaraAutoLayout.createSequentialGroup()
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 79, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jPanel10.getAccessibleContext().setAccessibleDescription("");

        btnMenuGaraAuto.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnMenuGaraAuto.setText("MENÚ PRINCIPAL >>");
        btnMenuGaraAuto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuGaraAutoActionPerformed(evt);
            }
        });

        btnGrabarAutom.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnGrabarAutom.setText("GRABAR");
        btnGrabarAutom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGrabarAutomActionPerformed(evt);
            }
        });

        btnExportarHipo.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnExportarHipo.setLabel("EXPORTAR");
        btnExportarHipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExportarHipoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(btnExportarHipo, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnGrabarAutom)
                        .addGap(180, 180, 180)
                        .addComponent(btnMenuGaraAuto, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(pnlCreacionGaraAuto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(pnlCreacionGaraAuto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnMenuGaraAuto)
                    .addComponent(btnExportarHipo)
                    .addComponent(btnGrabarAutom))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        btnExportarHipo.getAccessibleContext().setAccessibleName("Exportar");

        jTabbedPane1.addTab("INGRESO GARANTÍA AUTOMOTRIZ", jPanel4);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE PATENTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        btnBuscarIngresoGarantiaAutomotriz.setText("BUSCAR");
        btnBuscarIngresoGarantiaAutomotriz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarIngresoGarantiaAutomotrizActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                .addContainerGap(41, Short.MAX_VALUE)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnBuscarIngresoGarantiaAutomotriz, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                    .addComponent(txtBuscarPatente))
                .addGap(39, 39, 39))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtBuscarPatente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnBuscarIngresoGarantiaAutomotriz)
                .addContainerGap(14, Short.MAX_VALUE))
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ÁREA IMPRESIÓN", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        tbSalidaImpresionAutomotriz.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tbSalidaImpresionAutomotriz.setEnabled(false);
        jScrollPane1.setViewportView(tbSalidaImpresionAutomotriz);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1)
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
                .addContainerGap())
        );

        btnImprimirAutomotriz.setText("IMPRIMIR");
        btnImprimirAutomotriz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImprimirAutomotrizActionPerformed(evt);
            }
        });

        btnMenuPrincipalAuto.setText("MENÚ PRINCIPAL");
        btnMenuPrincipalAuto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalAutoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(276, 276, 276)
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(337, 337, 337)
                .addComponent(btnImprimirAutomotriz, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 184, Short.MAX_VALUE)
                .addComponent(btnMenuPrincipalAuto, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(25, 25, 25))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnImprimirAutomotriz)
                    .addComponent(btnMenuPrincipalAuto))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("IMPRIMIR", jPanel6);

        jLabel1.setText("MENÚ PRINCIPAL\\INGRESO GARANTÍA AUTOMOTRIZ");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblLogo)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(114, 114, 114)
                        .addComponent(lblIngresoGaraAuto))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblIngresoGaraAuto)
                    .addComponent(lblLogo)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 488, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        setSize(new java.awt.Dimension(816, 622));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        try {
        if(ValidarRutDAO.validarRut(this.txtRutBuscar.getText().toUpperCase()))
           {
          javax.swing.JOptionPane.showMessageDialog(this, "Rut valido");
        String buscarPorRut = txtRutBuscar.getText().toString().trim();
        if(txtRutBuscar.getText().length()>0){
        garanteDTO garante = reg.buscarPorRut(this.txtRutBuscar.getText().trim());
        if (reg.validar_rut(buscarPorRut) == true){
        this.txtRutGara.setText(garante.getRut_gara());
        this.txtApellidoPaterno.setText(garante.getApell_paterno_gara());
        this.txtApellidoMaterno.setText(garante.getApell_materno_gara());
        this.txtNombre.setText(garante.getNombre_gara());
        this.txtFechNac.setText(String.valueOf(garante.getFecha_nac_gara()));
        this.txtSexo.setText(garante.getSexo_gara());
        this.txtCalleAvenida.setText(garante.getCalle_gara());
        this.txtNumero.setText(String.valueOf(garante.getNum_gara()));
        this.txtDepto.setText(garante.getDepto_gara());
        this.txtRegion.setText(garante.getReg_gara());
        this.txtComuna.setText(garante.getComu_gara());
        this.txtTelParticular.setText(String.valueOf(garante.getTel_part_gara()));
        this.txtTelMovil.setText(String.valueOf(garante.getTel_mov_gara()));

//        cargarTxtArea();
            }
         else
        { 
         javax.swing.JOptionPane.showMessageDialog(this, "Rut Gatarantía Automotriz No Existente");
         
        this.txtRutGara.setText(null);
        this.txtApellidoPaterno.setText(null);
        this.txtApellidoMaterno.setText(null);
        this.txtNombre.setText(null);
        this.txtFechNac.setText(null);
        this.txtSexo.setText(null);
        this.txtCalleAvenida.setText(null);
        this.txtNumero.setText(null);
        this.txtDepto.setText(null);
        this.txtRegion.setText(null);
        this.txtComuna.setText(null);
        this.txtTelParticular.setText(null);
        this.txtTelMovil.setText(null);
        this.txtDescripcionAuto.setText(null);
        }
        }
        else
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Rut");
        }
        
        }else
        {
         javax.swing.JOptionPane.showMessageDialog(this, "Rut invalido");
        }
        }catch (Exception e) {
            e.getMessage();
            javax.swing.JOptionPane.showMessageDialog(this, "Rut No Existente");
        }
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnExaminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExaminarActionPerformed
         JFileChooser filechooser = new JFileChooser();
        int opcion = filechooser.showOpenDialog(this);
        if (opcion==JFileChooser.APPROVE_OPTION){
            txtAdjuntarArchivo.setText(filechooser.getSelectedFile().getPath());// TODO add your handling code here:
    }//GEN-LAST:event_btnExaminarActionPerformed
    }
    private void btnAdjuntarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdjuntarActionPerformed
        if(!this.txtAdjuntarArchivo.getText().equals("")){
        garantiaAutomotrizDTO garaAuto = new garantiaAutomotrizDTO();
        garaAuto.setAdjuntar_auto(this.txtAdjuntarArchivo.getText().trim());
        javax.swing.JOptionPane.showMessageDialog(this, "Archivo guardado");
        }else{
        javax.swing.JOptionPane.showMessageDialog(this, "Adjunte archivo");
        }
    }//GEN-LAST:event_btnAdjuntarActionPerformed

    private void btnMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        IngresoGarantiaAutomotriz.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalActionPerformed

    private void btnGrabarAutomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGrabarAutomActionPerformed
        garantiaAutomotrizDTO garaAuto = new garantiaAutomotrizDTO();
        String patente = txtPatente.getText().trim();
        if(txtRutBuscar.getText().length()>0){
      if(reg.validar_automotriz(patente) != true){
        if (this.txtDireccion.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Dirección");
        } else if (this.txtPatente.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Patente");
        } else if (this.txtNumChasis.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Número de Chasis");
        } else if (this.txtAño.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Año");
        } else if (this.txtNumMotor.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Número Motor");
        } else if (this.txtNumRegPrenda.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Número Registro Prenda");
        }
        else if(this.cmbMarca.getSelectedIndex() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese una Marca");
        }
        else if(this.cmbModelo.getSelectedIndex()== 0)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese un Modelo");
        }
        else if(this.cmbMoneda.getSelectedIndex() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese un Tipo de Modena");
        }
        else if(this.cmbSucursal.getSelectedIndex() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese una Sucursal");
        }
        else if(this.cmbTipoGarantia.getSelectedIndex() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese un Tipo de Garantia");
        }
          else if(this.txtFechaCreacion.getText().length() == 0)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese una Fecha de Creacion");  
        }
          else if(this.jcFechExtincion.getDate() == null)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese una Fecha de Extincion");
        }
          else if(this.jcFechModifica.getDate() == null)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Fecha Modificacion");
        }
          else if(this.jcFechUltCredito.getDate() == null)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Fecha Ultimo Credito");
        }
          else if(this.jcFechUltDebito.getDate() == null)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Fecha Ultimo Debito");
        }
          else if(this.jcFechUltRevaluo.getDate() == null)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Fecha Ultimo Revaluo");
        }
          else if(this.jcFechUltTasacion.getDate() == null)
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Fecha Ultima Tasacion");
        }else if (this.txtMontoInicial.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Monto");
        }
         else {
            garaAuto.setRut_gara_auto(this.txtRutGara.getText().trim());
            garaAuto.setApell_paterno_auto(this.txtApellidoPaterno.getText().trim());
            garaAuto.setApell_materno_auto(this.txtApellidoMaterno.getText().trim());
            garaAuto.setNombre_auto(this.txtNombre.getText().trim());
            garaAuto.setFech_nac_auto(this.txtFechNac.getText());
            garaAuto.setSexo_auto(this.txtSexo.getText().trim());
            garaAuto.setCalle_auto(this.txtCalleAvenida.getText().trim());
            garaAuto.setNum_auto(Integer.parseInt(this.txtNumero.getText().trim()));
            garaAuto.setDepto_auto(this.txtDepto.getText().trim());
            garaAuto.setReg_auto(this.txtRegion.getText().trim());
            garaAuto.setComu_auto(this.txtComuna.getText().trim());
            garaAuto.setTel_part_auto(Integer.parseInt(this.txtTelParticular.getText().trim()));
            garaAuto.setTel_mov_auto(Integer.parseInt(this.txtTelMovil.getText().trim()));
            garaAuto.setSucursal_auto(this.cmbSucursal.getSelectedItem().toString());
            garaAuto.setDireccion_auto(this.txtDireccion.getText().trim());
            garaAuto.setMarca_auto(this.cmbMarca.getSelectedItem().toString());
            garaAuto.setPatente_auto(this.txtPatente.getText().trim());
            garaAuto.setNum_chasis_auto(this.txtNumChasis.getText().trim());
            try {
                Date fechaCreacion = (new SimpleDateFormat("dd/MM/yyyy").parse(txtFechaCreacion.getText()));
                garaAuto.setFech_crea_auto(fechaCreacion);
            } catch (ParseException ex) {
                Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            garaAuto.setFech_ult_debito_auto(new SimpleDateFormat("dd/MM/yyyy").format(this.jcFechUltDebito.getDate()));
            garaAuto.setMoneda_auto(this.cmbMoneda.getSelectedItem().toString());
            garaAuto.setAño_auto(Integer.parseInt(this.txtAño.getText().trim()));
            garaAuto.setNum_motor_auto(Integer.parseInt(this.txtNumMotor.getText().trim()));
            garaAuto.setFecha_ult_tasa_auto(new SimpleDateFormat("dd/MM/yyyy").format(this.jcFechUltTasacion.getDate()));
            garaAuto.setFecha_modifi_auto(new SimpleDateFormat("dd/MM/yyyy").format(this.jcFechModifica.getDate()));
            garaAuto.setTipo_garantia_auto(this.cmbTipoGarantia.getSelectedItem().toString());
            garaAuto.setModelo_auto(this.cmbModelo.getSelectedItem().toString());
            garaAuto.setNum_reg_prenda_auto(Integer.parseInt(this.txtNumRegPrenda.getText().toString()));
            garaAuto.setFech_extincion_auto(new Date(this.jcFechExtincion.getDate().getTime()));
            garaAuto.setFech_ult_reval_auto(new SimpleDateFormat("dd/MM/yyyy").format(this.jcFechUltRevaluo.getDate()));
            garaAuto.setFech_ult_reval_credito_auto(new SimpleDateFormat("dd/MM/yyyy").format(this.jcFechUltCredito.getDate()));
            garaAuto.setNombre_garantia_auto("Automotriz");
            garaAuto.setDescrip_auto(this.txtDescripcionAuto.getText().trim());
            garaAuto.setComent_auto(this.txtOtroComentarioAuto.getText().trim());
            garaAuto.setAdjuntar_auto(this.txtAdjuntarArchivo.getText().trim());

            garaAuto.setMonto_inicial(Integer.parseInt(this.txtMontoInicial.getText().trim()));
            
            reg.creacionGarantiaAutomotriz(garaAuto, user);
            javax.swing.JOptionPane.showMessageDialog(this, "Garantia Automotriz almacenada con Exito");
        }
        }
        else
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Número de patente ya existe");
        }
        }
     else
     {
         javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Rut en Info Garante");
     }

        limpiar();
    }//GEN-LAST:event_btnGrabarAutomActionPerformed

    private void btnMenuGaraAutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuGaraAutoActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        IngresoGarantiaAutomotriz.this.dispose();
    }//GEN-LAST:event_btnMenuGaraAutoActionPerformed

    private void txtDireccionKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtDireccionKeyReleased
        if (!this.txtDireccion.getText().matches("[ 0-9 A-Za-z Ññáéíóú]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo letras y/o números ");
            this.txtDireccion.setText("");
        }
    }//GEN-LAST:event_txtDireccionKeyReleased

    private void txtPatenteKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPatenteKeyReleased
        if (!this.txtPatente.getText().matches("[ 0-9 A-Za-z Ññáéíóú]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo letras y/o números ");
            this.txtPatente.setText("");
        }
    }//GEN-LAST:event_txtPatenteKeyReleased

    private void txtNumChasisKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumChasisKeyReleased
        if (!this.txtNumChasis.getText().matches("[ 0-9 A-Za-z Ññáéíóú]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo letras y/o números ");
            this.txtNumChasis.setText("");
        }
    }//GEN-LAST:event_txtNumChasisKeyReleased

    private void txtAñoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAñoKeyReleased
        if (!this.txtAño.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
            this.txtAño.setText("");
        }
    }//GEN-LAST:event_txtAñoKeyReleased

    private void txtNumMotorKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumMotorKeyReleased
        if (!this.txtNumMotor.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
            this.txtNumMotor.setText("");
        }
    }//GEN-LAST:event_txtNumMotorKeyReleased

    private void txtNumRegPrendaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumRegPrendaKeyReleased
        if (!this.txtNumRegPrenda.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
            this.txtNumRegPrenda.setText("");
        }
    }//GEN-LAST:event_txtNumRegPrendaKeyReleased

    private void btnExportarHipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportarHipoActionPerformed
         String rut = this.txtRutBuscar.getText().trim();
        reg.exportarGarantiaAutomotriz(rut);
        javax.swing.JOptionPane.showMessageDialog(this, "Exportación realizada con exito");
        File file = new File("C:/export_garantia_Automotriz.csv");
        try {
            Desktop.getDesktop().open(file);
        } catch (IOException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnExportarHipoActionPerformed

    private void txtCalleAvenidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCalleAvenidaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCalleAvenidaActionPerformed

    private void txtMontoInicialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMontoInicialActionPerformed
        if (!this.txtMontoInicial.getText().matches("[ 0-9]*")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese solo números");
            this.txtMontoInicial.setText("");
        }
    }//GEN-LAST:event_txtMontoInicialActionPerformed

    private void txtAdjuntarArchivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtAdjuntarArchivoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtAdjuntarArchivoActionPerformed

    private void btnBuscarIngresoGarantiaAutomotrizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarIngresoGarantiaAutomotrizActionPerformed
         try
         {
             ArrayList<garantiaAutomotrizDTO> salida = reg.ListarPorPatenteAuto(this.txtBuscarPatente.getText().trim());
             if(salida.isEmpty())
             {
                 
                 this.txtBuscarPatente.setText(null);
                 DefaultTableModel model = (DefaultTableModel)this.tbSalidaImpresionAutomotriz.getModel();
                 model.setNumRows(0);
                 javax.swing.JOptionPane.showMessageDialog(this, "No hay garantias registradas!");
             }else
             {
                 
                 DefaultTableModel model = (DefaultTableModel)this.tbSalidaImpresionAutomotriz.getModel();
                 model.setColumnCount(0);
                 
                 if(model.getColumnCount() < 1)
                {
                    
                    Object[] arr1 ={"Rut: ","Nombre: ", "Dirección: ", "Garantía: ", "Número identificatorio Automotriz: ",
                        "Número de folio: ", "Monto incial: ", "Creación de la garantía: ", "Sucursal:  ",
                        "Dirección (Crédito): ","Marca: ","Número de Chasis: ","Fecha ultimo debito",
                        "Moneda: ","Año: ","Número de Motor: ","Fecha última Tasación: ","Tipo garantía: ",
                        "Modelo: ","Número Regsitro de Prenda: ","Fecha vencimiento: ","Fecha último revaluo: ",
                        "Fecha último crédito: ","Usuario: " };
                    model.addColumn("Concepto", arr1);
                    
                    for(garantiaAutomotrizDTO a: salida)
                {
                    Object[] arr2 ={
                         a.getRut_gara_auto(),
                         a.getNombre_auto() + "  " + a.getApell_paterno_auto() + "  " + a.getApell_materno_auto(),
                         a.getCalle_auto() + "  " + a.getDireccion_auto(),
                         a.getNombre_garantia_auto(),
                         a.getPatente_auto(),
                         a.getFolio_garantia_auto(),
                         a.getMonto_inicial(),
                         a.getFech_crea_auto(),
                         a.getSucursal_auto(),
                         a.getDireccion_auto(),a.getMarca_auto(),a.getNum_chasis_auto(),a.getFech_ult_debito_auto(),
                         a.getMoneda_auto(),a.getAño_auto(),a.getNum_motor_auto(),a.getFecha_ult_tasa_auto(),
                         a.getTipo_garantia_auto(),a.getModelo_auto(),a.getNum_reg_prenda_auto(),a.getFech_extincion_auto(),
                         a.getFech_ult_reval_auto(),a.getFech_ult_reval_credito_auto(),
                         a.getNombre_usuario()
                    };
                     
                    model.addColumn("Contenido",arr2);    
                }
                    
                    Object[] arr3 = {" "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "," "," "," "," "," "," ",
                                     " "," "," "," "};
                    model.addColumn("Observaciones",arr3);
                    
                }

             }
         }
         catch(Exception e)
         {
             e.getMessage();
         }
    }//GEN-LAST:event_btnBuscarIngresoGarantiaAutomotrizActionPerformed

    private void btnImprimirAutomotrizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirAutomotrizActionPerformed
          try {
            
        int fila= 0;
  
        List Resultados = new ArrayList();
        ComprobanteGeneralDTO tipo;
        Resultados.clear();
        
        for(fila = 0; fila< tbSalidaImpresionAutomotriz.getRowCount(); fila++)
        {
            
           tipo = new ComprobanteGeneralDTO(String.valueOf(tbSalidaImpresionAutomotriz.getValueAt(fila, 0)),
                    " " + String.valueOf(tbSalidaImpresionAutomotriz.getValueAt(fila, 1)), " " + String.valueOf(tbSalidaImpresionAutomotriz.getValueAt(fila, 2))  + "\n");
           Resultados.add(tipo);

        }
        
            String reportSource = "C:\\Users\\SoftGroup\\Documents\\NetBeansProjects\\trunk\\AppGarantias\\build\\classes\\Reporte\\ComprobanteGeneralGarantias.jrxml";

            JasperReport jr = JasperCompileManager.compileReport(reportSource);
            
            
            JFrame reporte = new JFrame();
            reporte.setSize(900, 700);
            reporte.setLocationRelativeTo(null);
            reporte.setTitle("IMPRESIÓN");
            String fechaImpresion = String.valueOf(Fechas.FechaSistema());
            
            Map<String, Object> map = new HashMap<String, Object>();
            
            map.put("Titulo", "Sistema Gestión de Garantías Bancarias");
            map.put("fecha", fechaImpresion);
            map.put("nombreBanco", "Banco xxxxxx");
            map.put("subtitulo", "Comprobante Ingreso Automotriz");
            map.put("timbre", "Timbre");
            map.put("fechaUsuario","Fecha");
            map.put("firma","Firma");

            
            
            JRBeanCollectionDataSource coleccion = new JRBeanCollectionDataSource(Resultados);
            JasperPrint jp = JasperFillManager.fillReport(jr, map, coleccion);
            JRViewer jv = new JRViewer(jp);
            reporte.getContentPane().add(jv);
            reporte.setVisible(true);
            
            
            
        } catch (JRException e) {
            e.printStackTrace();
            Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(Level.SEVERE, null, e);
        }
    }//GEN-LAST:event_btnImprimirAutomotrizActionPerformed

    private void btnMenuPrincipalAutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalAutoActionPerformed
         MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        IngresoGarantiaAutomotriz.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalAutoActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /*
//         * Set the Nimbus look and feel
//         */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /*
//         * If Nimbus (introduced in Java SE 6) is not available, stay with the
//         * default look and feel. For details see
//         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(IngresoGarantiaAutomotriz.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /*
//         * Create and display the form
//         */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new IngresoGarantiaAutomotriz().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel FechCreacion;
    private javax.swing.JLabel FechUltCredito;
    private javax.swing.JLabel FechUltDebito;
    private javax.swing.JButton btnAdjuntar;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnBuscarIngresoGarantiaAutomotriz;
    private javax.swing.JButton btnExaminar;
    private javax.swing.JButton btnExportarHipo;
    private javax.swing.JButton btnGrabarAutom;
    private javax.swing.JButton btnImprimirAutomotriz;
    private javax.swing.JButton btnMenuGaraAuto;
    private javax.swing.JButton btnMenuPrincipal;
    private javax.swing.JButton btnMenuPrincipalAuto;
    private javax.swing.JComboBox cmbMarca;
    private javax.swing.JComboBox cmbModelo;
    private javax.swing.JComboBox cmbMoneda;
    private javax.swing.JComboBox cmbSucursal;
    private javax.swing.JComboBox cmbTipoGarantia;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private com.toedter.calendar.JDateChooser jcFechExtincion;
    private com.toedter.calendar.JDateChooser jcFechModifica;
    private com.toedter.calendar.JDateChooser jcFechUltCredito;
    private com.toedter.calendar.JDateChooser jcFechUltDebito;
    private com.toedter.calendar.JDateChooser jcFechUltRevaluo;
    private com.toedter.calendar.JDateChooser jcFechUltTasacion;
    private javax.swing.JLabel lblApellidoMater;
    private javax.swing.JLabel lblApellidoPater;
    private javax.swing.JLabel lblArchivo;
    private javax.swing.JLabel lblArchivo1;
    private javax.swing.JLabel lblAño;
    private javax.swing.JLabel lblCalleAvenida;
    private javax.swing.JLabel lblComuna;
    private javax.swing.JLabel lblDepto;
    private javax.swing.JLabel lblDescripcion;
    private javax.swing.JLabel lblDireccion;
    private javax.swing.JLabel lblFechExtincion;
    private javax.swing.JLabel lblFechModifica;
    private javax.swing.JLabel lblFechNac;
    private javax.swing.JLabel lblFechUltRevaluo;
    private javax.swing.JLabel lblFechUltTasacion;
    private javax.swing.JLabel lblIngresoGaraAuto;
    private javax.swing.JLabel lblLogo;
    private javax.swing.JLabel lblMarca;
    private javax.swing.JLabel lblModelo;
    private javax.swing.JLabel lblMoneda;
    private javax.swing.JLabel lblNombre;
    private javax.swing.JLabel lblNumChasis;
    private javax.swing.JLabel lblNumMotor;
    private javax.swing.JLabel lblNumRegPrenda;
    private javax.swing.JLabel lblNumero;
    private javax.swing.JLabel lblPatente;
    private javax.swing.JLabel lblRegion;
    private javax.swing.JLabel lblRut;
    private javax.swing.JLabel lblRutGara;
    private javax.swing.JLabel lblSexo;
    private javax.swing.JLabel lblSucursal;
    private javax.swing.JLabel lblTelMovil;
    private javax.swing.JLabel lblTelParticular;
    private javax.swing.JLabel lblTipoGarantia;
    private javax.swing.JPanel pnlCreacionGaraAuto;
    private javax.swing.JPanel pnlDatosPersoGara;
    private javax.swing.JPanel pnlDescripGarantia;
    private javax.swing.JPanel pnlIngreseRutGarante;
    private javax.swing.JTable tbSalidaImpresionAutomotriz;
    private javax.swing.JTextField txtAdjuntarArchivo;
    private javax.swing.JTextField txtApellidoMaterno;
    private javax.swing.JTextField txtApellidoPaterno;
    private javax.swing.JTextField txtAño;
    private javax.swing.JTextField txtBuscarPatente;
    private javax.swing.JTextField txtCalleAvenida;
    private javax.swing.JTextField txtComuna;
    private javax.swing.JTextField txtDepto;
    private javax.swing.JTextArea txtDescripcionAuto;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtFechNac;
    private javax.swing.JTextField txtFechaCreacion;
    private javax.swing.JTextField txtMontoInicial;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtNumChasis;
    private javax.swing.JTextField txtNumMotor;
    private javax.swing.JTextField txtNumRegPrenda;
    private javax.swing.JTextField txtNumero;
    private javax.swing.JTextArea txtOtroComentarioAuto;
    private javax.swing.JTextField txtPatente;
    private javax.swing.JTextField txtRegion;
    private javax.swing.JTextField txtRutBuscar;
    private javax.swing.JTextField txtRutGara;
    private javax.swing.JTextField txtSexo;
    private javax.swing.JTextField txtTelMovil;
    private javax.swing.JTextField txtTelParticular;
    // End of variables declaration//GEN-END:variables

    private void limpiar() {
        txtAdjuntarArchivo.setText(null);
        txtApellidoMaterno.setText(null);
        txtApellidoPaterno.setText(null);
        txtAño.setText(null);
        txtCalleAvenida.setText(null);
        txtComuna.setText(null);
        txtDepto.setText(null);
        txtDescripcionAuto.setText(null);
        txtDireccion.setText(null);
        txtFechNac.setText(null);
        
        txtMontoInicial.setText(null);
        txtNombre.setText(null);
        txtNumChasis.setText(null);
        txtNumMotor.setText(null);
        txtNumRegPrenda.setText(null);
        txtNumero.setText(null);
        txtOtroComentarioAuto.setText(null);
        txtPatente.setText(null);
        txtRegion.setText(null);
        txtRutBuscar.setText(null);
        txtRutGara.setText(null);
        txtSexo.setText(null);
        txtTelMovil.setText(null);
        txtTelParticular.setText(null);
        cmbMarca.setSelectedItem("Seleccione una Marca");
        cmbModelo.setSelectedItem("Seleccione un Modelo");
        cmbMoneda.setSelectedItem("Seleccione Moneda");
        cmbSucursal.setSelectedItem("Seleccione");
        cmbTipoGarantia.setSelectedItem("Seleccione");
        jcFechExtincion.setCalendar(null);
        jcFechModifica.setCalendar(null);
        jcFechUltCredito.setCalendar(null);
        jcFechUltDebito.setCalendar(null);
        jcFechUltRevaluo.setCalendar(null);
        jcFechUltTasacion.setCalendar(null);
    }
}
